﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ignitron.EEngine;
using Ignitron.EEngine.Maths;
using Ignitron.EEngine.Lighting;

namespace OpenTKLightingTool.Data
{
    /// <summary>
    /// Class represeting one material
    /// </summary>
    internal class Material
    {
        public EVector4 Ambient
        { get; set; }

        public EVector4 Diffuse
        { get; set; }

        public EVector4 Specular
        { get; set; }

        public EVector4 Emissive
        { get; set; }

        public float Shininess
        { get; set; }


        /// <summary>
        /// Constructor - set default values
        /// </summary>
        public Material()
        {
            Ambient = new EVector4(0.2f, 0.2f, 0.2f, 1f);
            Diffuse = new EVector4(0.8f, 0.8f, 0.8f, 1f);
            Specular = new EVector4(0f, 0f, 0f, 1f);
            Emissive = new EVector4(0f, 0f, 0f, 1f);
            Shininess = 0f;
        }

        /// <summary>
        /// Renders given material
        /// TO-DO: Emissive
        /// </summary>
        public void Render(IEngine engine)
        {
            EMaterial material = new EMaterial();
            material.Ambient = Ambient;
            material.Diffuse = Diffuse;
            material.Specular = Specular;
            material.Shininess = Shininess;

            engine.SetMaterial(material);
        }
    }
}
